package tests;

import java.util.ArrayList;

import engine.LeitorDeEngines;
import gui.Facade;
import junit.framework.TestCase;

public class ProcuraJurisprudenciaTest extends TestCase {
	private Facade facade;
	private final String Link1 = "http://www.stj.jus.br/SCON/jurisprudencia/toc.jsp?tipo_visualizacao=RESUMO&b=ACOR&livre=(Joao+Oliveira).min+(Primeira+Turma).org.+aborto&processo=12&data=%40DTDE+%3e%3D+19881128+e+%40DTDE+%3c%3D+20100527";
	private final String Link2 = "http://www.stf.jus.br/portal/jurisprudencia/listarJurisprudencia.asp?base=baseAcordaos&s1=+%20((Joao%20Oliveira).NORL.%20OU%20(Joao%20Oliveira).NORV.%20OU%20(Joao%20Oliveira).NORA.%20OU%20(Joao%20Oliveira).ACMS.)%20aborto+(12.NUME.%20OU%2012.ACMS.)+(@JULG%20%3e=%2019881128)(@JULG%20%3c=%2020100527)";
	protected void setUp() { 
		facade = Facade.getInstance();
	} 


	public void testGeracaoDeLinks() {
		ArrayList<String> links;
		links = facade.pesquisa("aborto", "12", "19881128", "20100527", "Joao Oliveira", "Primeira Turma", 
											 null, null, null, null, true, false);

		assertEquals("ERRO: Busca Jurisprudencia", Link1, links.get(0));
		assertEquals("ERRO: Busca Jurisprudencia", Link2, links.get(1));

	}
	
	public void testTamanhoDoArrayDeLinks() {
		ArrayList<String> links;
		links = facade.pesquisa("aborto", "12", "19881128", "20100527", "Joao Oliveira", "Primeira Turma", 
				 null, null, null, null, true, false);
		assertEquals("ERRO: Busca Jurisprudencia", 2, links.size());
	}
}
